package com.luke.star.persist.mapper;

import com.luke.star.persist.po.StParam;
import com.luke.star.persist.po.StParamExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface StParamMapper {
    @SelectProvider(type=StParamSqlProvider.class, method="countByExample")
    long countByExample(StParamExample example);

    @DeleteProvider(type=StParamSqlProvider.class, method="deleteByExample")
    int deleteByExample(StParamExample example);

    @Delete({
        "delete from st_param",
        "where st_key = #{stKey,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String stKey);

    @Insert({
        "insert into st_param (st_key, st_value, ",
        "remark, create_time, ",
        "update_time)",
        "values (#{stKey,jdbcType=VARCHAR}, #{stValue,jdbcType=VARCHAR}, ",
        "#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP})"
    })
    int insert(StParam record);

    @InsertProvider(type=StParamSqlProvider.class, method="insertSelective")
    int insertSelective(StParam record);

    @SelectProvider(type=StParamSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="st_key", property="stKey", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="st_value", property="stValue", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<StParam> selectByExample(StParamExample example);

    @Select({
        "select",
        "st_key, st_value, remark, create_time, update_time",
        "from st_param",
        "where st_key = #{stKey,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="st_key", property="stKey", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="st_value", property="stValue", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    StParam selectByPrimaryKey(String stKey);

    @UpdateProvider(type=StParamSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") StParam record, @Param("example") StParamExample example);

    @UpdateProvider(type=StParamSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") StParam record, @Param("example") StParamExample example);

    @UpdateProvider(type=StParamSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(StParam record);

    @Update({
        "update st_param",
        "set st_value = #{stValue,jdbcType=VARCHAR},",
          "remark = #{remark,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where st_key = #{stKey,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(StParam record);
}